package com.jlcindia;

public class Lab15 {

	public static void main(String[] args) {
		System.out.println(MyOuterClass.MyInnerClass.LENGTH);
		System.out.println(MyOuterClass.MyInnerClass.val);
		MyOuterClass.MyInnerClass.displayMessage();
		//MyInnerClass ref1=null;
		MyOuterClass.MyInnerClass ref=null;
		//System.out.println(ref.msg);
		ref=new MyOuterClass.MyInnerClass("Message from Main Method");
		
		//ref=new MyOuterClass().new MyInnerClass("Message from Main Method");
		//ref=new MyOuterClass().MyInnerClass("Message from Main Method");
		System.out.println(ref.msg);
		MyOuterClass.displayInOuterClass();
		new MyOuterClass().showInOuterClass();
		ref.showResult();
	}
}
	class MyOuterClass{
		int result=1045;
		static int value=1212;
				
		static class MyInnerClass{ //static inner class
		static int val=9090;//static variable
		static final int LENGTH=10;//constant
		String msg;//instance variable
		MyInnerClass(String msg){
			this.msg=msg;
		}
		static void displayMessage(){
			System.out.println("---displayMessage static inj Inner Class--");
		}
			
		void showResult(){
			System.out.println("\n--showResult() in Inner Class---");
			System.out.println("MSG\t:"+msg);
			System.out.println("val\t:"+val);
			System.out.println("****Member of Outer Class---");
			System.out.println("static\t:"+value);					
			System.out.println("ins\t:"+new MyOuterClass().result);
			//System.out.println("ins\t:"+result);
				}
		}
		void showInOuterClass(){
			System.out.println("\n---showInOuterClass---");
			MyInnerClass ref1=new MyInnerClass("Message in show Method");
			System.out.println(ref1.msg);//accessed without object of outer class
			System.out.println(value);	
		}
		static void displayInOuterClass(){
			System.out.println("\n--displayInOuterClass---");
			MyInnerClass ref1=new MyInnerClass("Message in Display Method");
			System.out.println(ref1.msg);//accessed without object of outer class
			System.out.println(value);	
			//System.out.println(result);
		}
	}